home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-03-07 | 4.0 KB | 153 lines | [TEXT/MPS ] |
- // Copyright © 1993,4 Apple Computer, Inc. All rights reserved
-
- // application constants
- constant kAppSymbol := '|ExpandoTime:PIEDTS| ;
- constant kAppString := "Expando Time";
-
- // for application size
- constant kMaxWidth := 240 ; // MP100 size
- constant kMaxHeight := 336 ; // MP100 size
- // ---- End Project Data ----
-
-
- // ---- File Expando Time.t ----
-
- // Before Script for "_view000"
- // Copyright © 1993,4 Apple Computer, Inc. All rights reserved
-
- _view000 :=
- {viewBounds: {left: 0, top: 0, right: 240, bottom: 336},
- viewSetupFormScript:
- func()
- begin
- // resize application to display, but
- // make sure it is no bigger than
- // a MessagePad
- b := GetAppParams() ;
- viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
- MIN(b.appAreaWidth, kMaxWidth),
- MIN(b.appAreaHeight, kMaxHeight));
- end,
- _proto: protoApp
- };
-
- _view001 := /* child of _view000 */
- {
- viewSetupFormScript:
- func()
- begin
- // setup the target slot, just create a temporary
- // frame to edit
- self.target := {time1: Time(), time2: 56345760};
-
- // now setup the lines array to have 2 time protos
- lines := [
- {_proto: pt_protoTimeExpando,
- label: "Now",
- path: 'time1},
- {_proto: pt_protoTimeExpando,
- label: "Then",
- path: 'time2}] ;
-
- // set the number of lines to display
- numLines := Length(lines) ;
-
- // finaly, call inherited method to make sure
- // everything gets setup correctly
- inherited:?viewSetupFormScript() ;
- end,
- editWidth: 150,
- editHeight: 50,
- viewBounds: {left: 26, top: 42, right: 218, bottom: 258},
- flushEdits:
- func()
- begin
- nil
- end,
- lines: nil,
- numlines: 2,
- _proto: protoExpandoShell
- };
-
-
-
- // After Script for "_view000"
- thisView := _view000;
- // set the title of this application
- thisView.title := kAppString ;
-
-
- // ---- Beginning of non-used User Protos ----
-
- // ---- File protoTimeExpando ----
-
- // Before Script for "_userproto000"
- // Copyright © 1993,4 Apple Computer, Inc. All rights reserved
-
- _userproto000 :=
- {viewBounds: {left: 3, top: 3, right: 5, bottom: 5},
- entryFlags: 1097233,
- textChanged:
- // do some error checking on the input
- func()
- begin
- // be nice and let text expando do what it needs to
- inherited:?textChanged();
-
- // now do some error checking
- // now set target slot to a number
- local num := StringToTime(entryLine.text);
-
- // the text could be bogus, so num may be nil
- // set it to a default
- // WARNING: ickky error feedback!
- if not num then
- begin
- if not StrEqual(entryLine.text, "") then
- begin
- local errorText := "'" & entryLine.Text & "' is not a valid time" ;
- :Notify(kNotifyAlert, EnsureInternal(kAppString),
- EnsureInternal(errorText)) ;
- // set the text back to what it was before the error
- // can do this because proto will add undo actions
- AddDeferredAction(func() PostCommand('application, aeUndo), []);
- end;
- num := 0 ;
- end;
-
- // finaly, write the data to the target
- target.(path) := num ;
-
- end,
- setup2:
- func(target)
- begin
- // this function gets called to figure out what
- // text to show for the value in the collapsed
- // state
- // just return a string
-
- if target then
- HourMinute(target.(path));
- end,
- textSetup:
- // show the correct text in the expanded entry
- func()
- begin
- // let the expando item to its work
- inherited:textSetup();
-
- // now get the right text
- HourMinute(target.(path));
- end,
- _proto: protoTextExpando
- };
-
-
- // ---- End of non-used User Protos ----
-
-
-
- // ---- Beginning of section for non used Layout files ----
-
- // End of output